package com.fanxl.flink.datastream.partitioner;

import org.apache.flink.api.common.functions.Partitioner;

/**
 * @description:
 * @author: fanxiaole
 * @date: 2022/1/21 15:50
 */
public class PKPartitioner implements Partitioner<String> {

    @Override
    public int partition(String key, int numPartitions) {
        if ("baidu.com".equals(key)) {
            return 0;
        } else if ("a.com".equals(key)) {
            return 1;
        }else {
            return 2;
        }
    }
}
